package ar.com.quickMart.logic;

import java.io.Serializable;

public abstract class Purchasable implements Comparable<Purchasable>, Serializable{

	

	/**
	 * 
	 */
	private static final long serialVersionUID = 5375655814084849083L;
	
	
	public abstract long getCode();
	public abstract  String getDescription();
	public abstract  Float getPrice();
	public abstract  int getCount();
	
	public abstract void setCode(long barCode);
	public abstract void setDescription(String description);
	public abstract void setCount(int count);
	public abstract void setPrice(Float price);
	
	@Override
	public int compareTo(Purchasable p){
		
		return this.getDescription().compareTo(p.getDescription());
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (getCode() ^ (getCode() >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Purchasable other = (Purchasable) obj;
		if (this.getCode() != other.getCode()) {
			return false;
		}
		return true;
	}
}
